package serviceImpl;

import dao.LoginDao;
import daoImpl.LoginDaoImpl;
import entity.User;
import service.LoginService;
import util.DatabaseUtil;

import java.sql.*;

public class LoginServiceImpl implements LoginService {
    @Override
    public int doLogin(String name, String pwd) {
        Connection conn = null;
        try {
            conn = DatabaseUtil.getConnection();
            LoginDao loginDao=new LoginDaoImpl(conn);

            return loginDao.doLogin(name,pwd);
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            DatabaseUtil.closeAll(conn, null, null);
        }
        return 0;
    }
}
